<?php
include 'database.php'; //数据库的配置信息
require 'lianjie.php';  // 数据库的操作函数
$Y = $_GET['y'];
$M = $_GET['m'];
$D = $_GET['d'];
$id = $_GET['id'];
$id = 'd'.$id;
$mac = $_GET['mac'];
$con = lianjieshujuku($servername, $name, $passwd);//连接数据库
if (!mysqli_select_db($con, 'flowdate')) {
    die("选择数据库失败");
}
$req = mysqli_query($con, "select `kongshi`,`kongwen`,`time`,`$id` from `$mac` WHERE `time` LIKE '$Y:$M:$D:%:%:%'");
//$m = mysqli_fetch_array($req);
$dataarray = Array();
$i = 0;
while($row=mysqli_fetch_array($req)) {
    $array = Array();
    $array['kongshi'] = $row['kongshi'];
    $array['kongwen'] = $row['kongwen'];
    $array['time'] = $row['time'];
    $array['d'] = $row["$id"];
    //print_r($row);
    $dataarray[$i] = $array;
    $i++;
    //echo "<br>";
}
echo json_encode($dataarray);
//print_r($dataarray);
//print_r($m);